<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>The Worker class</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="thread.wait.html">Thread::wait</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="worker.chunk.html">Worker::chunk</a></div>
 <div class="up"><a href="book.pthreads.html">pthreads</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="class.worker" class="reference">

 <h1 class="title">The Worker class</h1>
 

 <div class="partintro"><p class="verinfo">(PECL pthreads &gt;= 0.36)</p>


  <div class="section" id="worker.intro">
   <h2 class="title">简介</h2>
   <p class="para">
  Worker Threads have a persistent context, as such should be used over Threads in most cases.
   </p>
  </div>


  <div class="section" id="worker.synopsis">
   <h2 class="title">类摘要</h2>


   <div class="classsynopsis">
    <div class="ooclass"></div>


    <div class="classsynopsisinfo">
     <span class="ooclass">
      <strong class="classname">Worker</strong>
     </span>
     {</div>

    
    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 方法 */</div>
    <div class="methodsynopsis dc-description">
   <span class="modifier">final</span> <span class="modifier">public</span> <span class="type">boolean</span><span class="methodname"><a href="worker.chunk.html" class="methodname">chunk</a></span>
    ( <span class="methodparam"><span class="type"><span class="type long">long</span></span> <code class="parameter">$size</code></span>
   , <span class="methodparam"><span class="type">boolean</span> <code class="parameter">$preserve</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">final</span> <span class="modifier">public</span> <span class="type">long</span><span class="methodname"><a href="worker.getcreatorid.html" class="methodname">getCreatorId</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">final</span> <span class="modifier">public</span> <span class="type">int</span><span class="methodname"><a href="worker.getstacked.html" class="methodname">getStacked</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">final</span> <span class="modifier">public</span> <span class="type">long</span><span class="methodname"><a href="worker.getthreadid.html" class="methodname">getThreadId</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">final</span> <span class="modifier">public</span> <span class="type">boolean</span><span class="methodname"><a href="worker.isshutdown.html" class="methodname">isShutdown</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">final</span> <span class="modifier">public</span> <span class="type">boolean</span><span class="methodname"><a href="worker.isworking.html" class="methodname">isWorking</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">final</span> <span class="modifier">public</span> <span class="type">boolean</span><span class="methodname"><a href="worker.merge.html" class="methodname">merge</a></span>
    ( <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$from</code></span>
   [, <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$overwrite</code></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">final</span> <span class="modifier">public</span> <span class="type">boolean</span><span class="methodname"><a href="worker.pop.html" class="methodname">pop</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">abstract</span> <span class="modifier">public</span> <span class="type">void</span><span class="methodname"><a href="worker.run.html" class="methodname">run</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">final</span> <span class="modifier">public</span> <span class="type">boolean</span><span class="methodname"><a href="worker.shift.html" class="methodname">shift</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">final</span> <span class="modifier">public</span> <span class="type">boolean</span><span class="methodname"><a href="worker.shutdown.html" class="methodname">shutdown</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">final</span> <span class="modifier">public</span> <span class="type">int</span><span class="methodname"><a href="worker.stack.html" class="methodname">stack</a></span>
    ( <span class="methodparam"><span class="type"><a href="class.stackable.html" class="type Stackable">Stackable</a></span> <code class="parameter">$work</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">final</span> <span class="modifier">public</span> <span class="type">boolean</span><span class="methodname"><a href="worker.start.html" class="methodname">start</a></span>
    ([ <span class="methodparam"><span class="type"><span class="type long">long</span></span> <code class="parameter">$options</code></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">final</span> <span class="modifier">public</span> <span class="type">int</span><span class="methodname"><a href="worker.unstack.html" class="methodname">unstack</a></span>
    ([ <span class="methodparam"><span class="type"><a href="class.stackable.html" class="type Stackable">Stackable</a></span> <code class="parameter">$work</code></span>
  ] )</div>

   }</div>


  </div>

 </div>

 






























































































<h2>Table of Contents</h2><ul class="chunklist chunklist_reference"><li><a href="worker.chunk.html">Worker::chunk</a> — Manipulation</li><li><a href="worker.getcreatorid.html">Worker::getCreatorId</a> — Identification</li><li><a href="worker.getstacked.html">Worker::getStacked</a> — Stack Analysis</li><li><a href="worker.getthreadid.html">Worker::getThreadId</a> — Identification</li><li><a href="worker.isshutdown.html">Worker::isShutdown</a> — State Detection</li><li><a href="worker.isworking.html">Worker::isWorking</a> — State Detection</li><li><a href="worker.merge.html">Worker::merge</a> — Manipulation</li><li><a href="worker.pop.html">Worker::pop</a> — Manipulation</li><li><a href="worker.run.html">Worker::run</a> — Execution</li><li><a href="worker.shift.html">Worker::shift</a> — Manipulation</li><li><a href="worker.shutdown.html">Worker::shutdown</a> — Synchronization</li><li><a href="worker.stack.html">Worker::stack</a> — Stacking</li><li><a href="worker.start.html">Worker::start</a> — Execution</li><li><a href="worker.unstack.html">Worker::unstack</a> — Stacking</li></ul>
</div>
<hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="thread.wait.html">Thread::wait</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="worker.chunk.html">Worker::chunk</a></div>
 <div class="up"><a href="book.pthreads.html">pthreads</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
